﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using CsGL.OpenGL;

namespace GMPP.utils
{
    public class GlHelper : CsGL.OpenGL.GL
    {

        public new static void glVertexPointer(int size, uint type, int stride, dynamic pointer)
        {
            GCHandle verObj = GCHandle.Alloc(pointer, GCHandleType.Pinned);
            IntPtr vObj = verObj.AddrOfPinnedObject();
            GL.glVertexPointer(size, type, stride, vObj);
        }

        public new static void glTexCoordPointer(int size, uint type, int stride, dynamic pointer)
        {
            GCHandle verObj = GCHandle.Alloc(pointer, GCHandleType.Pinned);
            IntPtr vObj = verObj.AddrOfPinnedObject();
            GL.glTexCoordPointer(size, type, stride, vObj);
        }



        public new static void glIndexPointer(uint type, int stride, dynamic pointer)
        {
            GCHandle verObj = GCHandle.Alloc(pointer, GCHandleType.Pinned);
            IntPtr vObj = verObj.AddrOfPinnedObject();
            GL.glIndexPointer(type, stride, vObj);
        }



        public new static void glNormalPointer(uint type, int stride, dynamic pointer)
        {
            GCHandle verObj = GCHandle.Alloc(pointer, GCHandleType.Pinned);
            IntPtr vObj = verObj.AddrOfPinnedObject();
            GL.glNormalPointer(type, stride, vObj);
        }

    }
}
